ut = {}

function ut.cast(name , target)
	if not ut.isUsableSpell(name) then
		return false
	end

	if target and not ut.isInRange(name, target) then
		return false
	end

	CastSpellByName(name, target)
	return true
end

function ut.isInRange(spell, target)
	return IsSpellInRange(spell, target) == 1
end

function ut.isUsableSpell(name) 
	local usable, nomana = IsUsableSpell(name)
	local cd = getCD(name)
	-- print(name, usable, nomana, cd)
	return usable and not nomana and cd < 0.1
end

function ut.buffExist(name)
	return getBuffRemianTime('player', name) > 0
end

local function getTarget(t_)
	-- body
	local t = t_
	if t == 'other' then
		t = PVPOther()
	end
	return t
end

